<?php

class ProfileDocumentTypeConfigurationService extends BaseService
{

    /**
     * @ignore
     * @var ProfileDocumentTypeConfigurationDao
     */
    private $profileDocumentTypeDao;

    /**
     * @ignore
     */
    public function getProfileDocumentTypeDao()
    {

        if (!($this->profileDocumentTypeDao instanceof ProfileDocumentTypeConfigurationDao)) {
            $this->profileDocumentTypeDao = new ProfileDocumentTypeConfigurationDao();
        }

        return $this->profileDocumentTypeDao;
    }

    /**
     * @ignore
     */
    public function setProfileDocumentTypeDao($profileDocumentTypeDao)
    {
        $this->profileDocumentTypeDao = $profileDocumentTypeDao;
    }

    /**
     * Saves a profileDocumentType
     *
     * Can be used for a new record or updating.
     *
     * @version 2.6.12
     * @param ProfileDocumentType $profileDocumentType
     * @return NULL Doesn't return a value
     *
     * @todo return saved entity [DONE]
     */
    public function saveProfileDocumentType(ProfileDocumentType $profileDocumentType)
    {
        return $this->getProfileDocumentTypeDao()->saveProfileDocumentType($profileDocumentType);
    }

    /**
     * Retrieves a profileDocumentType by ID
     *
     * @version 2.6.12
     * @param int $id
     * @return ProfileDocumentType An instance of ProfileDocumentType or NULL
     *
     * @todo rename method as getProfileDocumentType( $id )[DONE]
     */
    public function getProfileDocumentType($id)
    {
        return $this->getProfileDocumentTypeDao()->getProfileDocumentType($id);
    }

    /**
     * Retrieves a reporting method by code
     *
     * Case insensitive
     *
     * @version 2.6.12
     * @param string $code
     * @return ProfileDocumentType An instance of ProfileDocumentType or false
     */
    public function getProfileDocumentTypeByCode($code)
    {
        return $this->getProfileDocumentTypeDao()->getProfileDocumentTypeByCode($code);
    }

    /**
     * Retrieves all profileDocumentTypes ordered by code
     *
     * @version 2.6.12
     * @return Doctrine_Collection A doctrine collection of ProfileDocumentType objects
     */
    public function getProfileDocumentTypeList($sortBy = 'code', $sortOrder = 'ASC', $activeOnly = true)
    {
        return $this->getProfileDocumentTypeDao()->getProfileDocumentTypeList($sortBy, $sortOrder, $activeOnly);
    }

    /**
     * Deletes profileDocumentTypes
     *
     * @version 2.6.12
     * @param array $ids An array of IDs to be deleted
     * @return int Number of records deleted
     */
    public function deleteProfileDocumentTypes($ids)
    {
        return $this->getProfileDocumentTypeDao()->deleteProfileDocumentTypes($ids);
    }

    /**
     * Checks whether the given profileDocumentType code exists
     *
     * Case insensitive
     *
     * @version 2.6.12
     * @param string $profileDocumentTypeCode ProfileDocumentType code that needs to be checked
     * @return boolean
     *
     *
     */
    public function isExistingProfileDocumentTypeCode($profileDocumentTypeCode)
    {
        return $this->getProfileDocumentTypeDao()->isExistingProfileDocumentTypeCode($profileDocumentTypeCode);
    }

}